In [5]:
from data_processing import JacksonDataProcessing
In [ ]:
# Create the JacksonDataProcessing class to perform analysis.
new_city = JacksonDataProcessing(geopackage_location = "/data/vector/jackson_ms_water_crisis.gpkg",
                                 city_boundary_or_mask = "/data/vector/jackson_ms_water_crisis.gpkg",
                                 mask_layer_name="jackson_city_boundary_census")
In [ ]:
# Mask USGS road features to Jackson, MS boundary. This greatly reduces the load time and memory resources needed to import the full dataset.add
masked_roads = new_city.mask_roads("/data/Transportation_National_GPKG.gpkg", "Trans_RoadSegment")
masked_roads.head()
Out[ ]:
permanent_identifier source_featureid source_datasetid source_datadesc source_originator loaddate interstate us_route state_route county_route ... us_route_a us_route_b us_route_c state_route_a state_route_b state_route_c globalid shape_Length tnmfrc_description geometry
0 530bf8ca-ad17-45a4-8b1f-4f65021f54de 110811369481 {6507407E-90CD-4C11-B7EC-E9BF9DA3D338} 2017 Oct MAFTIGER U.S. Department of Commerce, U.S. Census Burea... 2017-12-11 18:31:36+00:00 None None None None ... None None None None None None {0BDC6290-4381-4C7D-870B-227D1186A018} 0.000502 Local Road MULTILINESTRING ((719901.545 321465.899, 71990...
1 6450f1df-b5d1-42b8-9571-9808d7e7f659 1102381671916 {6507407E-90CD-4C11-B7EC-E9BF9DA3D338} 2017 Oct MAFTIGER U.S. Department of Commerce, U.S. Census Burea... 2017-12-11 18:28:30+00:00 None None None None ... None None None None None None {2D10E226-48B4-43C6-B559-9F2BF0611A53} 0.000500 Local Road MULTILINESTRING ((720034.379 321373.126, 71998...
2 3407668c-cdc6-43d6-b68b-9f7911b0a860 110688477581 {6507407E-90CD-4C11-B7EC-E9BF9DA3D338} 2017 Oct MAFTIGER U.S. Department of Commerce, U.S. Census Burea... 2017-12-11 18:27:38+00:00 None None None None ... None None None None None None {03D1C5C5-D9C0-45E3-955E-82818E765292} 0.002394 Local Road MULTILINESTRING ((720024.717 321264.214, 72002...
3 db7c3400-5613-41e2-9097-0a25c6b67382 110688477581 {6507407E-90CD-4C11-B7EC-E9BF9DA3D338} 2017 Oct MAFTIGER U.S. Department of Commerce, U.S. Census Burea... 2017-12-11 18:27:38+00:00 None None None None ... None None None None None None {534F1471-C204-4A98-8598-4C7ACD5C05ED} 0.000377 Local Road MULTILINESTRING ((720034.379 321373.126, 72002...
4 00c2e2df-36f6-4f7c-a988-a7428721f178 110688477581 {6507407E-90CD-4C11-B7EC-E9BF9DA3D338} 2017 Oct MAFTIGER U.S. Department of Commerce, U.S. Census Burea... 2017-12-11 18:27:38+00:00 None None None None ... None None None None None None {66FFDCE1-5156-475A-B668-33BA9A19E9A8} 0.001832 Local Road MULTILINESTRING ((720178.340 321409.120, 72012...

5 rows × 28 columns

In [ ]:
# Filter data to relavent columns, and visualize data into an interactable map.
masked_roads[["name", "tnmfrc_description", "geometry"]].rename(columns={"tnmfrc_description": "Road Description"}).explore(column="Road Description", cmap="Dark2", width=800, height=600)
Out[ ]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [ ]:
# Calculate the number of distribution sites per 10,000 people based on zip code demographic data.
water_dist_per_capita_by_zip = new_city.water_distribution_by_tiger_zip_per_capital("/data/vector/census/tl_2024_us_zcta520.zip",
                                                                             "/data/tabular/DECENNIALDHC2020.P1_2025-02-19T235338/DECENNIALDHC2020.P1-Data.csv",
                                                                             "/data/vector/jackson_ms_water_crisis.gpkg",
                                                                             "water_distribution_stations_DUPS_REMOVED_FOR_LABELS")
water_dist_per_capita_by_zip.sort_values("Per_10000_ppl")
Out[ ]:
ZCTA5CE20 GEOIDFQ20_x geometry index GEOIDFQ20_y count Geography Geographic Area Name !!Total Unnamed: 3 Per_10000_ppl
3 39056 860Z200US39056 POLYGON ((690552.291 324835.527, 690557.289 32... 12962 NaN NaN 860Z200US39056 ZCTA5 39056 27346 NaN 0.000000
2 39218 860Z200US39218 MULTIPOLYGON (((719457.722 294733.862, 719469.... 13043 NaN NaN 860Z200US39218 ZCTA5 39218 7231 NaN 0.000000
5 39047 860Z200US39047 POLYGON ((724256.145 323592.116, 724265.038 32... 12959 NaN NaN 860Z200US39047 ZCTA5 39047 39191 NaN 0.000000
4 39201 860Z200US39201 POLYGON ((712111.532 307736.502, 712137.017 30... 13030 NaN NaN 860Z200US39201 ZCTA5 39201 574 NaN 0.000000
7 39217 860Z200US39217 POLYGON ((711170.565 309911.787, 711178.583 31... 13042 NaN NaN 860Z200US39217 ZCTA5 39217 1466 NaN 0.000000
11 39157 860Z200US39157 POLYGON ((708421.529 326882.958, 708422.008 32... 13008 NaN NaN 860Z200US39157 ZCTA5 39157 24611 NaN 0.000000
10 39208 860Z200US39208 MULTIPOLYGON (((715162.624 308310.464, 715197.... 13035 NaN NaN 860Z200US39208 ZCTA5 39208 34228 NaN 0.000000
8 39206 860Z200US39206 POLYGON ((712425.039 319054.927, 712445.494 31... 13034 NaN NaN 860Z200US39206 ZCTA5 39206 22553 NaN 0.000000
15 39210 860Z200US39210 POLYGON ((714229.200 312922.225, 714229.465 31... 13037 NaN NaN 860Z200US39210 ZCTA5 39210 456 NaN 0.000000
19 39232 860Z200US39232 MULTIPOLYGON (((730755.403 317020.933, 731038.... 13044 NaN NaN 860Z200US39232 ZCTA5 39232 9052 NaN 0.000000
20 39269 860Z200US39269 POLYGON ((713566.067 310601.887, 713566.777 31... 13045 NaN NaN 860Z200US39269 ZCTA5 39269 0 NaN 0.000000
12 39211 860Z200US39211 POLYGON ((716476.694 314780.795, 716478.041 31... 13038 860Z200US39211 1.0 860Z200US39211 ZCTA5 39211 24900 NaN 0.401606
9 39204 860Z200US39204 POLYGON ((704639.260 309709.852, 704654.598 30... 13033 860Z200US39204 1.0 860Z200US39204 ZCTA5 39204 15433 NaN 0.647962
0 39272 860Z200US39272 POLYGON ((701830.169 296107.756, 701840.917 29... 13046 860Z200US39272 1.0 860Z200US39272 ZCTA5 39272 14022 NaN 0.713165
18 39212 860Z200US39212 MULTIPOLYGON (((703968.125 302415.050, 703972.... 13039 860Z200US39212 3.0 860Z200US39212 ZCTA5 39212 29087 NaN 1.031389
16 39209 860Z200US39209 MULTIPOLYGON (((700247.595 307952.129, 700250.... 13036 860Z200US39209 3.0 860Z200US39209 ZCTA5 39209 25227 NaN 1.189202
6 39202 860Z200US39202 POLYGON ((713201.669 311052.270, 713238.099 31... 13031 860Z200US39202 1.0 860Z200US39202 ZCTA5 39202 7405 NaN 1.350439
17 39203 860Z200US39203 MULTIPOLYGON (((710834.647 313035.439, 710859.... 13032 860Z200US39203 1.0 860Z200US39203 ZCTA5 39203 4395 NaN 2.275313
13 39216 860Z200US39216 MULTIPOLYGON (((714910.914 315710.036, 714922.... 13041 860Z200US39216 1.0 860Z200US39216 ZCTA5 39216 4061 NaN 2.462448
14 39213 860Z200US39213 MULTIPOLYGON (((716307.583 320849.210, 716309.... 13040 860Z200US39213 5.0 860Z200US39213 ZCTA5 39213 19507 NaN 2.563182
1 39174 860Z200US39174 POLYGON ((715818.223 322367.827, 715874.899 32... 13018 860Z200US39174 1.0 860Z200US39174 ZCTA5 39174 491 NaN 20.366599
In [ ]:
# Clip the zip code polygons to the city boundary, and filter columns before visualizing as an interactive map. The scheme is for illustration purposes only and may not be appropiate for the data shown.
clipped_water_dist_per_capita_by_zip = new_city.clip_gdf_to_city(water_dist_per_capita_by_zip)
m = clipped_water_dist_per_capita_by_zip[["ZCTA5CE20","count", " !!Total", "Per_10000_ppl", "geometry"]].explore(column = "Per_10000_ppl", cmap="Reds", scheme="Quantiles", style_kwds=dict(fillOpacity=100), width=800, height=600)
m
Out[ ]:
Make this Notebook Trusted to load map: File -> Trust Notebook